package com.acane.instagram.feature.chat

import android.content.Context
import android.net.Uri
import java.io.File
import java.util.Locale

// FileUtil.kt
object FileUtil {
    fun fromUri(context: Context, uri: Uri): File {
        return File(uri.path!!) // 根据实际需要处理URI到文件的转换
    }
    
    // 获取MIME类型扩展方法
    val File.mimeType: String
        get() = when (extension.toLowerCase(Locale.ROOT)) {
            "jpg", "jpeg" -> "image/jpeg"
            "png" -> "image/png"
            "gif" -> "image/gif"
            "mp4" -> "video/mp4"
            "mov" -> "video/quicktime"
            else -> "application/octet-stream"
        }
}